home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / lib / perl / assert.ph < prev    next >
Encoding:
Text File  |  1991-08-12  |  1.3 KB  |  51 lines

  1. require 'cfuncproto.ph';
  2. if (defined &assert) {
  3. }
  4. if (defined &_assert) {
  5. }
  6. if (!defined &NDEBUG) {
  7.     if (defined &KERNEL) {
  8.     if (defined &__STDC__) {
  9.         eval 'sub _assert {
  10.             local($ex) = @_;
  11.             eval "{  &if (!($ex)) {  &panic( \\"Assertion failed: (\\" #$ex \\") file \\\\\\"%s\\\\\\", line %d\\\\n\\",  &__FILE__,  &__LINE__);}}";
  12.         }';
  13.     }
  14.     else {
  15.         eval 'sub _assert {
  16.             local($ex) = @_;
  17.             eval "{  &if (!($ex)) {  &panic( \\"Assertion failed: file \\\\\\"%s\\\\\\", line %d\\\\n\\",  &__FILE__,  &__LINE__);}}";
  18.         }';
  19.     }
  20.     }
  21.     else {
  22.     if (defined &__STDC__) {
  23.         eval 'sub _assert {
  24.             local($ex) = @_;
  25.             eval "{  &if (!($ex)) {  &__eprintf( \\"Assertion failed: (\\" #$ex \\") line %d of \\\\\\"%s\\\\\\"\\\\n\\",  &__LINE__,  &__FILE__);  &abort();}}";
  26.         }';
  27.     }
  28.     else {
  29.         eval 'sub _assert {
  30.             local($ex) = @_;
  31.             eval "{  &if (!($ex)) {  &__eprintf( \\"Assertion failed: line %d of \\\\\\"%s\\\\\\"\\\\n\\",  &__LINE__,  &__FILE__);  &abort();}}";
  32.         }';
  33.     }
  34.     }
  35.     eval 'sub assert {
  36.         local($ex) = @_;
  37.         eval " &_assert($ex)";
  38.     }';
  39. }
  40. else {
  41.     eval 'sub _assert {
  42.         local($ex) = @_;
  43.         eval "";
  44.     }';
  45.     eval 'sub assert {
  46.         local($ex) = @_;
  47.         eval "";
  48.     }';
  49. }
  50. 1;
  51.